﻿#region License
//------------------------------------------------------------
// Copyright (c) Denis Vuyka.  All rights reserved.
// This source code is subject to terms and conditions of the 
// Microsoft Reciprocal License (Ms-RL) License for Carcass. 
// A copy of the license can be found in the License.txt file 
// at the root of this distribution. 
// By using this source code in any fashion, you are agreeing 
// to be bound by the terms of the 
// Microsoft Reciprocal License (Ms-RL) License
// You must not remove this notice from this software.
//------------------------------------------------------------
#endregion

using System.ComponentModel.Composition;
using System.IO;

namespace Carcass.Contents
{
  /// <summary>
  /// Identifies a general document in the Carcass document system.
  /// </summary>
  [ContractType(MetadataViewType = typeof(IDocumentMetadata))]
  public interface IDocument
  {
    /// <summary>
    /// Gets a value indicating whether this document can load itself.
    /// </summary>
    /// <value><c>true</c> if this document can load itself; otherwise, <c>false</c>.</value>
    bool CanLoad { get; }

    /// <summary>
    /// Gets a value indicating whether this document can save itself.
    /// </summary>
    /// <value><c>true</c> if this document can save itself; otherwise, <c>false</c>.</value>
    bool CanSave { get; }

    /// <summary>
    /// Loads the document data.
    /// </summary>
    /// <param name="stream">The stream containing document data.</param>
    void Load(Stream stream);

    /// <summary>
    /// Saves the document data.
    /// </summary>
    /// <param name="stream">The stream to write document data to.</param>
    void Save(Stream stream);    
  }
}